package com.overlord.im.client.start;

import com.google.common.base.Throwables;
import com.overlord.im.client.api.ClientMsgListener;
import com.overlord.im.commons.message.OverlordImMessage;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * All rights Reserved, Designed By www.szy.cn
 *
 * @author wuwei
 * @title DefaultClientListener
 * @package com.overlord.im.client.start
 * @date 2021-03-15 16:12
 * @Copyright 2014-现在 All rights reserved. 厦门神州鹰软件科技有限公司
 */
public class DefaultClientListener implements ClientMsgListener {
    private static final Logger LOGGER = LoggerFactory.getLogger(DefaultClientListener.class);

    @Override
    public void online() {
        LOGGER.info("用户已连接...");
    }

    @Override
    public void read(OverlordImMessage chatMsg) {

    }

    @Override
    public void hasSent(Long id) {
        LOGGER.info("用户已发送消息{}", id);
    }

    @Override
    public void hasDelivered(Long id) {
        LOGGER.info("用户已发送消息{}", id);
    }

    @Override
    public void hasRead(Long id) {
        LOGGER.info("用户已读取消息{}", id);
    }

    @Override
    public void offline() {
        LOGGER.info("用户已下线...");
    }

    @Override
    public void hasException(ChannelHandlerContext ctx, Throwable cause) {
        LOGGER.error("连接异常{}", Throwables.getStackTraceAsString(cause));
    }
}
